package habi.cat.youdao.supermemo;

import java.io.File;
import java.io.FileWriter;
import java.util.List;

/**
 * Hello world!
 *
 */
public class App {
    private static final int ARGNUM = 2;

    private static void usage() {
        System.err.printf("Usage : java -cp <classpath> %s <input xml> <output>\n", App.class.getName());
    }

    public static void main(String[] args) throws Exception {
        if(ARGNUM != args.length) {
            usage();
            System.exit(1);
        }
        
        File file = new File(args[0]);
        YouDaoWordLoader loader = new YouDaoWordLoader();
        List<YouDaoWordItem> list = loader.load(file);
        File output = new File(args[1]);
        FileWriter w = new FileWriter(output);
        SuperMemoSaver save = new SuperMemoSaver();
        save.save1(w, list);
        w.close();
    }
}
